package com.fantastic.common.result;

import com.fantastic.common.exception.enums.RespStatusInfo;

/**
 * @author: rxx
 * @since: 2024/5/22 16:12
 * @description: 请求后要响应对象
 */
public class ResultData {
    /**
     * 状态码
     */
    private Integer errorCode;

    /**
     * 消息
     */
    private String message;

    /**
     * 要响应回去的数据
     */
    private Object data;

    /**
     * 用来响应成功的请求
     * @param respStatusInfo    状态码枚举
     * @param data  具体要响应回去数据
     */
    public ResultData(RespStatusInfo respStatusInfo, Object data) {
        this.errorCode = respStatusInfo.getCode();
        this.message = respStatusInfo.getMessage();
        this.data = data;
    }
    /**
     * 用来响应成功的请求
     * @param respStatusInfo    状态码枚举
     */
    public ResultData(RespStatusInfo respStatusInfo) {
        this.errorCode = respStatusInfo.getCode();
        this.message = respStatusInfo.getMessage();
    }


    public Integer getErrorCode() {
        return errorCode;
    }

    public String getMessage() {
        return message;
    }

    public Object getData() {
        return data;
    }
}
